﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Employees_EmployeesProfile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
            ((HiddenField)Master.FindControl("HoverId")).Value = "EmpProfile";




            MasterPage_MasterPage_EmpDetail master = (MasterPage_MasterPage_EmpDetail)this.Page.Master;

            master.HelpHref = "";
            master.PageName = "员工信息";
            master.PicUrl = "~/image/PageIcon/emp.jpg";
            master.IntiBar();
        }
    }

    private void Bind()
    {

        try
        {

            if (Request["action"] != null)
            {
                int Eid = Convert.ToInt32(Request["eid"]);

                string[] mode = Server.UrlDecode(Request["mode"]).ToString().Split(',');

                for (int i = 0; i < mode.Length; i++)
                {
                    switchVis(mode[i].ToString());
                }


                if (Request["action"].ToString() == "add")
                {
                    PrivyInfonew.Visible = false;
                    HrInfonew.Visible = false;
                    //SalaryInfonew.Visible = false;

                    IndividualInfonew.Visible = true;
                    IndividualInfonew.Action = true;

                    //Eid = 100;
                }
                else if (Request["action"].ToString() == "view")
                {
                    //SalaryInfonew.ReadOnly = true;
                    HrInfonew.ReadOnly = true;
                    IndividualInfonew.ReadOnly = true;
                    PrivyInfonew.ReadOnly = true;



                }
                else if (Request["action"].ToString() == "edit")
                {
                    //SalaryInfonew.ReadOnly = false;
                    HrInfonew.ReadOnly = false;
                    IndividualInfonew.ReadOnly = false;
                    PrivyInfonew.ReadOnly = false;


                }
                else if (Request["action"].ToString() == "self")
                {
                    //SalaryInfonew.ReadOnly = true;
                    HrInfonew.ReadOnly = true;
                    IndividualInfonew.ReadOnly = true;
                }


                PrivyInfonew.Eid = Eid;
                IndividualInfonew.Eid = Eid;
                HrInfonew.Eid = Eid;
                //SalaryInfonew.Eid = Eid;
            }
            else
            {
                proDiv.Visible = false;
            }
        }
        catch
        {

        }
    }


    private void switchVis(string value)
    {

        switch (value)
        {
            case "self":
                PrivyInfonew.Visible = false;
                break;
            case "hr":
                HrInfonew.Visible = false;
                break;
            //case "salary":
            //    SalaryInfonew.Visible = false;
            //    break;
            case "emp":

                IndividualInfonew.Visible = false;
                break;
            default:
                break;
        }
    }
}
